using System.Windows.Input;
using System.Collections.Generic;

namespace Silvery.GameControls
{
    public class HotKeys : Dictionary<string,HotKey>
    {
        public HotKeys()
        {
        }
        /// <summary>
        /// 是否激活热键
        /// </summary>
        public bool IsEnabledHotKeys { get; set; }
        public HotKey Checking(Key key, ModifierKeys modiferkeys = ModifierKeys.None)
        {            
            foreach (var item in this.Values)
            {
                if (item.RegistModifierKeys == modiferkeys)
                {
                    if (item.RegistKey == key)
                        return item;
                }
            }
            return null;
        }
        public new bool Add(string key, HotKey value)
        {
            if(this.ContainsKey(key) || this.ContainsValue(value))
                return false;
            if (Checking(value.RegistKey, value.RegistModifierKeys) != null)
                return false;
            base.Add(key, value);
            return true;
            
        }
    }
}
